home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
Clut fade 1.3.2 Folder.sit
/
Clut fade 1.3.2 Folder
/
clut_fade 1.3.2
/
Pascal
/
TestfadeC.p
< prev
next >
Wrap
Text File
|
1996-05-15
|
5KB
|
198 lines
program TestFade;
{/******************************************************************************** }
{ PROJECT: clut_fade.ケ }
{ FILE: shell.c }
{ PURPOSE: 'clut' fading functions}
{ }
{ STATUS: Public Domain Demo. }
{********************************************************************************/ }
uses
Fade;
{********************************************************************************/ }
procedure init_toolbox;
begin
MaxApplZone;
MoreMasters;
InitGraf(@thePort);
InitFonts;
InitWindows;
InitMenus;
TEInit;
InitDialogs(nil);
InitCursor;
FlushEvents(everyEvent, 0);
end;
{********************************************************************************/ }
procedure test_window;
var
d: DialogPtr;
g: GrafPtr;
hit: integer;
hGD: GDHandle;
hCTab: CTabHandle;
ticks: longint;
fadeSpeed: integer;
iHandle: Handle;
iType: integer;
iRect: Rect;
tHandle: Handle;
th2: CTabHandle;
origColors: CTabHandle;
mainDevice: GDHandle;
aColor: RGBColor;
newColors: CTabHandle;
x: integer;
begin
d := GetNewDialog(128, nil, pointer(-1));
if d <> nil then
begin
GetPort(g);
SetPort(d);
ShowWindow(d);
repeat
ModalDialog(nil, hit);
GetDItem(d, 10, iType, iHandle, iRect);
fadeSpeed := GetCtlValue(ControlHandle(iHandle));
case hit of
{// fade all monitors to black}
2:
begin
{// fade out}
fade_to_black(fadeSpeed, fadeAll, true);
{// wait a few seconds}
Delay(120, ticks);
{// fade in}
fade_to_black(fadeSpeed, fadeAll, false);
end;
{// fade main monitor to black}
3:
begin
{// fade out}
fade_to_black(fadeSpeed, fadeMainOnly, true);
{// wait a few seconds}
Delay(120, ticks);
{// fade in}
fade_to_black(fadeSpeed, fadeMainOnly, false);
end;
{// fade all monitors except main monitor to black}
4:
begin
{// fade out}
fade_to_black(fadeSpeed, fadeAllButMain, true);
{// wait a few seconds}
Delay(120, ticks);
{// fade in}
fade_to_black(fadeSpeed, fadeAllButMain, false);
end;
{// fade main monitor to red}
5:
begin
mainDevice := GetMainDevice;
{// make a copy of the color table so we can restore it later}
copy_gdevice_clut(mainDevice, origColors);
{// fade to a color}
aColor.red := 65535;
aColor.green := 0;
aColor.blue := 0;
fade_to_color(fadeSpeed, aColor, mainDevice);
{// wait a few seconds}
Delay(120, ticks);
{// fade back to original color table}
fade_to_clut(fadeSpeed, origColors, mainDevice);
{// dispose the copy we made}
DisposeHandle(Handle(origColors));
end;
{// fade main monitor through rainbow}
6:
begin
mainDevice := GetMainDevice;
{// make a copy of the color table so we can restore it later}
copy_gdevice_clut(mainDevice, origColors);
for x := 128 to 134 do {for (x = 128; x < 135; x++)}
begin
{// get a custom color table (red or blue)}
newColors := GetCTable(x);
{// limit it to current depth}
newColors^^.ctSize := origColors^^.ctSize;
SetHandleSize(Handle(newColors), GetHandleSize(Handle(origColors));
{// fade to the custow color table}
fade_to_clut(40, newColors, mainDevice);
ReleaseResource(Handle(newColors));
end;
{// fade back to original color table}
fade_to_clut(40, origColors, mainDevice);
{// dispose the copy we made}
DisposeHandle(Handle(origColors));
end;
{// fade to inverted clut}
7:
begin
mainDevice := GetMainDevice;
{// make a copy of the color table so we can restore it later}
copy_gdevice_clut(mainDevice, origColors);
{// make a copy of the color table so we manipulate it}
copy_gdevice_clut(mainDevice, newColors);
{// reverse order of colors for a fun effect}
for x := 0 to (newColors^^.ctSize + 1) div 2 do {for (x = 0; x < (((**newColors).ctSize+1)/2); x++)}
begin
aColor := newColors^^.ctTable[x].rgb;
newColors^^.ctTable[x].rgb := newColors^^.ctTable[newColors^^.ctSize - x].rgb;
newColors^^.ctTable[newColors^^.ctSize - x].rgb := aColor;
end;
{ change the ctSeed so we know it is different than original }
newColors^^.ctSeed := GetCTSeed;
{// fade to it}
fade_to_clut(fadeSpeed, newColors, mainDevice);
{// wait a few seconds}
Delay(120, ticks);
{// fade back to original color table}
fade_to_clut(fadeSpeed, origColors, mainDevice);
{// dispose the copy we made}
DisposeHandle(Handle(origColors));
end;
end;
until (hit = 1);
SetPort(g);
DisposDialog(d);
end;
end;
{/*********************************** main ***************************************/}
begin
init_toolbox;
test_window;
end.